
<input type="hidden" name="indent_id" value="<{$indent.id}>" />
<table border="0" cellpadding="4" cellspacing="0" width="100%"><tbody>
<tr>
	<td width="80" valign="top">供应商：</td>
	<td valign="top"><? $indent.supplier ?></td>
	<td width="15%" class="right">日 期：</td>
	<td><?= date('Y-m-d H:i', $indent.addtime) ?></td>
</tr>
</table>

<table border="0" class="list">
<tbody>
<tr class="nobg">
	<th>编号</th>
	<th>材料名称</th>
	<th>品牌</th>
	<th>规格</th>
	<th width="35">单位</th>
	<th>订单数量</th>
	<th>剩余数量</th>
	<th width="80">实际入库量</th>
	<th>单价</th>
	<th>金额</th>
	<th>备注</th>
	<th width="50">入库</th>
</tr>
<? $amount = 0; ?>
<{foreach item=ware from=$indent.items}>
	<tr id="selstf_<{$ware.ware_id}>">
		<td><{$ware.sno}></td>
		<td><{$ware.name}></td>
		<td><{$ware.brand}></td>
		<td><{$ware.specific}></td>
		<td><{$ware.unit}></td>
		<td><div class="decimal"><{$ware.amount}></div></td>
		<td><div class="decimal"><{$ware.amount-$ware.amount_back}></div></td>
		<td><input type="text" class="decimal" size="5" name="amount[<{$ware.ware_id}>]" value="<{$ware.amount - $ware.amount_back}>" /></td>
		<td><div class="decimal fnum"><{$ware.price}></div></td>
		<td><div class="decimal fnum"><{= $ware.price * $ware.amount}></div></td>
		<td><div class="text"><{= $ware.remark}></div></td>
		<td><input type="checkbox" <{if $ware.amount==$ware.amount_back}> remove=1<{/if}> /></td>
	</tr>
	<? $amount += $ware.amount ?>
<{/foreach}>
</tbody></table>

<p>
	仓库：<?= Html::options(Warehouse::getList(), 'warehouse_id', '', 'name', 'warehouse_id', '--选择仓库--') ?> &nbsp;  &nbsp;  &nbsp; 
	质检：<?= Html::options($demandReviewers, 'reviewer[]', '', '', '', '')
//			Html::options2(array(
//				'name' => 'reviewer[]',
//				'id' => 'reviewer_id',
//				'data' => $users,
//				'val_key' => 'id',
//				'text_key' => 'name',
//			));
			?> &nbsp;  &nbsp;  &nbsp; 
	采购：<?= Html::options($indentReviewers, 'reviewer[]') ?> &nbsp;  &nbsp;  &nbsp; 
	仓管：<?= UserAuthHelper::name() ?><input type="hidden" name="reviewer[]" value="<?= UserAuthHelper::uid() ?>" />
</p>

<br/>
<div class="center">
	<INPUT TYPE="button" class="button" value="取消" onclick="$(this).parent().parent().html('')"> &nbsp;
	<INPUT TYPE="submit" class="button" value="生成入库单" />
</div>

<script>
resize_fnum();

$('input[type=checkbox]').each(function(){
	with($(this).parent().parent()){
		addClass('disabled');
		find('input[type=text]').attr('disabled',true);
	}
	if($(this).attr('remove')){
		$(this).remove();
	}
}).click(function(){
	with($(this).parent().parent()){
		if($(this).attr('checked')){
			removeClass('disabled');
			find('input[type=text]').attr('disabled',false);
		}
		else{
			addClass('disabled');
			find('input[type=text]').attr('disabled',true);
		}
	}
});
ajax_form({id:'form1', before:function(){return window.confirm('确认生成入库单？');},success:function(jsn){ $('#snobtn').click(); }});
</script>
